shadeIn = 0.75
lxIn = 161.4
time = 17
sun = 0.3456
state = 0

flag = 0
shadeOut = shadeIn - 0.25
if shadeOut >= 0
    flag = 1
else
    shadeOut = shadeIn
end
lxOut = lxIn
while flag
    lxOut = -77.519*time - 0.003*lxIn + 110.433*sun - 832.208*shadeOut + 412*state + 1920.257
    shadeOut = shadeOut - 0.25
    if shadeOut < 0
        shadeOut = shadeOut + 0.25
        flag = 0
        break
    elseif lxOut >= 500
        flag = 0
        break
    else
        lxIn = lxOut
    end
    lxIn = lxOut
end
